<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Set grouping attribute</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="sphinxclient.setgeoanchor.html">SphinxClient::setGeoAnchor</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="sphinxclient.setgroupdistinct.html">SphinxClient::setGroupDistinct</a></div>
 <div class="up"><a href="class.sphinxclient.html">SphinxClient</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="sphinxclient.setgroupby" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SphinxClient::setGroupBy</h1>
  <p class="verinfo">(PECL sphinx &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">SphinxClient::setGroupBy</span> &mdash; <span class="dc-title">Set grouping attribute</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-sphinxclient.setgroupby-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><strong>SphinxClient::setGroupBy</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$attribute</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$func</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$groupsort</code><span class="initializer"> = &quot;@group desc&quot;</span></span>
  ] )</div>

  <p class="para rdfs-comment">
   Sets grouping attribute, function, and group sorting mode, and enables
   grouping.
  </p>
  <p class="para">
   Grouping feature is very similar to GROUP BY clause in SQL.
   Results produced by this function call are going to be the same as produced
   by the following pseudo code:
   <strong class="command">SELECT ... GROUP BY $func($attribute) ORDER BY $groupsort</strong>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-sphinxclient.setgroupby-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">attribute</code></em></dt>

     <dd>

      <p class="para">
       A string containing group-by attribute name.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">func</code></em></dt>

     <dd>

      <p class="para">
       Constant, which sets a function applied to the attribute value in order
       to compute group-by key.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">groupsort</code></em></dt>

     <dd>

      <p class="para">
       An optional clause controlling how the groups are sorted.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-sphinxclient.setgroupby-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-sphinxclient.setgroupby-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><a href="sphinxclient.resetgroupby.html" class="xref">SphinxClient::resetGroupBy</a></li>
    <li class="member"><a href="sphinxclient.setsortmode.html" class="xref">SphinxClient::setSortMode</a></li>
    <li class="member"><a href="sphinxclient.setgroupdistinct.html" class="xref">SphinxClient::setGroupDistinct</a></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="sphinxclient.setgeoanchor.html">SphinxClient::setGeoAnchor</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="sphinxclient.setgroupdistinct.html">SphinxClient::setGroupDistinct</a></div>
 <div class="up"><a href="class.sphinxclient.html">SphinxClient</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
